package net.discard.model;

import net.discard.model.jy.enums.TopicEnum;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.ViewType;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.InputType;
import xyz.erupt.annotation.sub_field.sub_edit.Search;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.upms.model.base.HyperModel;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * @author Discard
 * @date 06/02/2115:10
 */
@Erupt(name = "用户管理",
        power = @Power(importable = true, export = true),
        orderBy = "id desc"
)
@Entity
@Table(name = "user")
public class User extends HyperModel {

    @EruptField(
            views = @View(title = "微信码"),
            edit = @Edit(
                    readOnly = true, title = "微信码"
            )
    )
    private String openid;

    @EruptField(
            views = @View(title = "微信昵称"),
            edit = @Edit(
                    readOnly = true, title = "微信昵称"
            )
    )
    private String nickName;

    @EruptField(
            views = @View(title = "性别"),
            edit = @Edit(
                    readOnly = true, title = "性别",
                    type = EditType.CHOICE, choiceType = @ChoiceType(
                    vl = {
                            @VL(label = "男", value = "1"),
                            @VL(label = "女", value = "2")
                    }
            ))
    )
    private int gender;

    @EruptField(
            views = {
                    @View(title = "头像", type = ViewType.LINK_DIALOG),
            }
    )
    private String avatarUrl;

    private String wechatStr;

    @CreatedDate
    public Date createTime;

    @LastModifiedDate
    public Date updateTime;

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getWechatStr() {
        return wechatStr;
    }

    public void setWechatStr(String wechatStr) {
        this.wechatStr = wechatStr;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public Date getUpdateTime() {
        return updateTime;
    }

    @Override
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
